package com.company.learning.singleton;

/**
 * @Author: zhaoqi
 * @Date: 8/25/2019 6:31 PM
 * @Version 1.0
 */
//饿汉式 单例模式  线程安全
public class Singleton4 {

    private static Singleton4 singleton4;

    private Singleton4(){
    }

    public static synchronized Singleton4 getInstance(){
        if (null == singleton4){
            singleton4 = new Singleton4();
        }
        return singleton4;
    }


}
